<template>
  <div id="app">
    <el-container v-if="$store.state.admin">
      <el-aside width="200px">
        <div class="avatar">
           <el-avatar  size='large' icon='el-icon-user-solid'></el-avatar>
           <span class="user">{{$store.state.admin}}</span>
        </div>
        <el-menu default-active="add" class="el-menu-vertical-demo" router>
          <el-menu-item index="add">
            <i class="el-icon-document"></i>
            <span slot="title">添加题目</span>
          </el-menu-item>
          <el-menu-item index="user">
            <i class="el-icon-setting"></i>
            <span slot="title">用户管理</span>
          </el-menu-item>
        </el-menu>
      </el-aside>
      <el-main>
        <router-view />
      </el-main>
    </el-container>
    <login v-else></login>
  </div>
</template>

<script>
import login from './views/login'
export default {
  data() {
    return {
    };
  },
  methods: {
    handleOpen(key, keyPath) {
      console.log(key, keyPath);
    },
    handleClose(key, keyPath) {
      console.log(key, keyPath);
    },
  },
  components:{
    login
  }
};
</script>

<style scoped>
#app {
  font-family: "Helvetica Neue",Helvetica,"PingFang SC","Hiragino Sans GB","Microsoft YaHei","微软雅黑",Arial,sans-serif;
  color: #2c3e50;
}
.avatar{
  padding-left: 20px;
}
.avatar span{
  vertical-align: middle;
}
.avatar .user{
  font-size: 20px;
  margin-left: 16px;
}
</style>
